<div style="margin-top:20px;color:#770777;font-size:20px;">
	<center>So you think you know us, do you?  Take our Polls below and see how well you really do know us.</center>
</div>	

<?php
	$PollQuestion=PollQuestion::model()->findAll();
	
	foreach($PollQuestion as $Question){
?>
	
		
	<form method="POST">
		<div id="<?php echo $Question->id; ?>" style="margin-left:50px;margin-top:50px;">
			<h3 style="color:#ffff99;"><?php echo $Question->question . '</br>';?></h3>
<?php
	$PollOption=PollOption::model()->findAll('question_id=?',array($Question->id));
	foreach ($PollOption as $Option){
		$option1=$Option->id;
		$ques_id=$Option->question_id;
?>
	<input type="hidden" name="hide" value='<?php echo $ques_id;?>'>
	<input type="radio" name="radio" value="<?php echo $option1 ?>" onclick="js:getVote(<?php echo $Question->id ?>,this.value)" />

	<b style="color:#ffff99;"><?php echo $Option->option . '<br/>';?></b>
<?php
	}?>
	 </div>
	</form>
	
<?php } ?>

<script type="text/javascript">
function getVote(id,opt)
{
	
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById(id).innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","<?php echo Yii::app()->createUrl('booklet/show');?>?q="+id+"&p="+opt,true);
xmlhttp.send();
}
</script>